﻿// Ported from
// https://github.com/tensorflow/tfjs-models/blob/master/facemesh/

/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */

using UnityEngine;

namespace TensorFlowLite
{
    public static class FaceMeshBuilder
    {
        private static readonly int[] TRIANGLES = new int[]
        {
            127, 34, 139, 11, 0, 37, 232, 231, 120, 72, 37, 39, 128, 121, 47, 232, 121,
            128, 104, 69, 67, 175, 171, 148, 157, 154, 155, 118, 50, 101, 73, 39, 40, 9,
            151, 108, 48, 115, 131, 194, 204, 211, 74, 40, 185, 80, 42, 183, 40, 92,
            186, 230, 229, 118, 202, 212, 214, 83, 18, 17, 76, 61, 146, 160, 29, 30, 56,
            157, 173, 106, 204, 194, 135, 214, 192, 203, 165, 98, 21, 71, 68, 51, 45, 4,
            144, 24, 23, 77, 146, 91, 205, 50, 187, 201, 200, 18, 91, 106, 182, 90, 91,
            181, 85, 84, 17, 206, 203, 36, 148, 171, 140, 92, 40, 39, 193, 189, 244,
            159, 158, 28, 247, 246, 161, 236, 3, 196, 54, 68, 104, 193, 168, 8, 117,
            228, 31, 189, 193, 55, 98, 97, 99, 126, 47, 100, 166, 79, 218, 155, 154, 26,
            209, 49, 131, 135, 136, 150, 47, 126, 217, 223, 52, 53, 45, 51, 134, 211,
            170, 140, 67, 69, 108, 43, 106, 91, 230, 119, 120, 226, 130, 247, 63, 53,
            52, 238, 20, 242, 46, 70, 156, 78, 62, 96, 46, 53, 63, 143, 34, 227, 173,
            155, 133, 123, 117, 111, 44, 125, 19, 236, 134, 51, 216, 206, 205, 154, 153,
            22, 39, 37, 167, 200, 201, 208, 36, 142, 100, 57, 212, 202, 20, 60, 99, 28,
            158, 157, 35, 226, 113, 160, 159, 27, 204, 202, 210, 113, 225, 46, 43, 202,
            204, 62, 76, 77, 137, 123, 116, 41, 38, 72, 203, 129, 142, 64, 98, 240, 49,
            102, 64, 41, 73, 74, 212, 216, 207, 42, 74, 184, 169, 170, 211, 170, 149,
            176, 105, 66, 69, 122, 6, 168, 123, 147, 187, 96, 77, 90, 65, 55, 107, 89,
            90, 180, 101, 100, 120, 63, 105, 104, 93, 137, 227, 15, 86, 85, 129, 102,
            49, 14, 87, 86, 55, 8, 9, 100, 47, 121, 145, 23, 22, 88, 89, 179, 6, 122,
            196, 88, 95, 96, 138, 172, 136, 215, 58, 172, 115, 48, 219, 42, 80, 81, 195,
            3, 51, 43, 146, 61, 171, 175, 199, 81, 82, 38, 53, 46, 225, 144, 163, 110,
            246, 33, 7, 52, 65, 66, 229, 228, 117, 34, 127, 234, 107, 108, 69, 109, 108,
            151, 48, 64, 235, 62, 78, 191, 129, 209, 126, 111, 35, 143, 163, 161, 246,
            117, 123, 50, 222, 65, 52, 19, 125, 141, 221, 55, 65, 3, 195, 197, 25, 7,
            33, 220, 237, 44, 70, 71, 139, 122, 193, 245, 247, 130, 33, 71, 21, 162,
            153, 158, 159, 170, 169, 150, 188, 174, 196, 216, 186, 92, 144, 160, 161, 2,
            97, 167, 141, 125, 241, 164, 167, 37, 72, 38, 12, 145, 159, 160, 38, 82, 13,
            63, 68, 71, 226, 35, 111, 158, 153, 154, 101, 50, 205, 206, 92, 165, 209,
            198, 217, 165, 167, 97, 220, 115, 218, 133, 112, 243, 239, 238, 241, 214,
            135, 169, 190, 173, 133, 171, 208, 32, 125, 44, 237, 86, 87, 178, 85, 86,
            179, 84, 85, 180, 83, 84, 181, 201, 83, 182, 137, 93, 132, 76, 62, 183, 61,
            76, 184, 57, 61, 185, 212, 57, 186, 214, 207, 187, 34, 143, 156, 79, 239,
            237, 123, 137, 177, 44, 1, 4, 201, 194, 32, 64, 102, 129, 213, 215, 138, 59,
            166, 219, 242, 99, 97, 2, 94, 141, 75, 59, 235, 24, 110, 228, 25, 130, 226,
            23, 24, 229, 22, 23, 230, 26, 22, 231, 112, 26, 232, 189, 190, 243, 221, 56,
            190, 28, 56, 221, 27, 28, 222, 29, 27, 223, 30, 29, 224, 247, 30, 225, 238,
            79, 20, 166, 59, 75, 60, 75, 240, 147, 177, 215, 20, 79, 166, 187, 147, 213,
            112, 233, 244, 233, 128, 245, 128, 114, 188, 114, 217, 174, 131, 115, 220,
            217, 198, 236, 198, 131, 134, 177, 132, 58, 143, 35, 124, 110, 163, 7, 228,
            110, 25, 356, 389, 368, 11, 302, 267, 452, 350, 349, 302, 303, 269, 357,
            343, 277, 452, 453, 357, 333, 332, 297, 175, 152, 377, 384, 398, 382, 347,
            348, 330, 303, 304, 270, 9, 336, 337, 278, 279, 360, 418, 262, 431, 304,
            408, 409, 310, 415, 407, 270, 409, 410, 450, 348, 347, 422, 430, 434, 313,
            314, 17, 306, 307, 375, 387, 388, 260, 286, 414, 398, 335, 406, 418, 364,
            367, 416, 423, 358, 327, 251, 284, 298, 281, 5, 4, 373, 374, 253, 307, 320,
            321, 425, 427, 411, 421, 313, 18, 321, 405, 406, 320, 404, 405, 315, 16, 17,
            426, 425, 266, 377, 400, 369, 322, 391, 269, 417, 465, 464, 386, 257, 258,
            466, 260, 388, 456, 399, 419, 284, 332, 333, 417, 285, 8, 346, 340, 261,
            413, 441, 285, 327, 460, 328, 355, 371, 329, 392, 439, 438, 382, 341, 256,
            429, 420, 360, 364, 394, 379, 277, 343, 437, 443, 444, 283, 275, 440, 363,
            431, 262, 369, 297, 338, 337, 273, 375, 321, 450, 451, 349, 446, 342, 467,
            293, 334, 282, 458, 461, 462, 276, 353, 383, 308, 324, 325, 276, 300, 293,
            372, 345, 447, 382, 398, 362, 352, 345, 340, 274, 1, 19, 456, 248, 281, 436,
            427, 425, 381, 256, 252, 269, 391, 393, 200, 199, 428, 266, 330, 329, 287,
            273, 422, 250, 462, 328, 258, 286, 384, 265, 353, 342, 387, 259, 257, 424,
            431, 430, 342, 353, 276, 273, 335, 424, 292, 325, 307, 366, 447, 345, 271,
            303, 302, 423, 266, 371, 294, 455, 460, 279, 278, 294, 271, 272, 304, 432,
            434, 427, 272, 407, 408, 394, 430, 431, 395, 369, 400, 334, 333, 299, 351,
            417, 168, 352, 280, 411, 325, 319, 320, 295, 296, 336, 319, 403, 404, 330,
            348, 349, 293, 298, 333, 323, 454, 447, 15, 16, 315, 358, 429, 279, 14, 15,
            316, 285, 336, 9, 329, 349, 350, 374, 380, 252, 318, 402, 403, 6, 197, 419,
            318, 319, 325, 367, 364, 365, 435, 367, 397, 344, 438, 439, 272, 271, 311,
            195, 5, 281, 273, 287, 291, 396, 428, 199, 311, 271, 268, 283, 444, 445,
            373, 254, 339, 263, 466, 249, 282, 334, 296, 449, 347, 346, 264, 447, 454,
            336, 296, 299, 338, 10, 151, 278, 439, 455, 292, 407, 415, 358, 371, 355,
            340, 345, 372, 390, 249, 466, 346, 347, 280, 442, 443, 282, 19, 94, 370,
            441, 442, 295, 248, 419, 197, 263, 255, 359, 440, 275, 274, 300, 383, 368,
            351, 412, 465, 263, 467, 466, 301, 368, 389, 380, 374, 386, 395, 378, 379,
            412, 351, 419, 436, 426, 322, 373, 390, 388, 2, 164, 393, 370, 462, 461,
            164, 0, 267, 302, 11, 12, 374, 373, 387, 268, 12, 13, 293, 300, 301, 446,
            261, 340, 385, 384, 381, 330, 266, 425, 426, 423, 391, 429, 355, 437, 391,
            327, 326, 440, 457, 438, 341, 382, 362, 459, 457, 461, 434, 430, 394, 414,
            463, 362, 396, 369, 262, 354, 461, 457, 316, 403, 402, 315, 404, 403, 314,
            405, 404, 313, 406, 405, 421, 418, 406, 366, 401, 361, 306, 408, 407, 291,
            409, 408, 287, 410, 409, 432, 436, 410, 434, 416, 411, 264, 368, 383, 309,
            438, 457, 352, 376, 401, 274, 275, 4, 421, 428, 262, 294, 327, 358, 433,
            416, 367, 289, 455, 439, 462, 370, 326, 2, 326, 370, 305, 460, 455, 254,
            449, 448, 255, 261, 446, 253, 450, 449, 252, 451, 450, 256, 452, 451, 341,
            453, 452, 413, 464, 463, 441, 413, 414, 258, 442, 441, 257, 443, 442, 259,
            444, 443, 260, 445, 444, 467, 342, 445, 459, 458, 250, 289, 392, 290, 290,
            328, 460, 376, 433, 435, 250, 290, 392, 411, 416, 433, 341, 463, 464, 453,
            464, 465, 357, 465, 412, 343, 412, 399, 360, 363, 440, 437, 399, 456, 420,
            456, 363, 401, 435, 288, 372, 383, 353, 339, 255, 249, 448, 261, 255, 133,
            243, 190, 133, 155, 112, 33, 246, 247, 33, 130, 25, 398, 384, 286, 362, 398,
            414, 362, 463, 341, 263, 359, 467, 263, 249, 255, 466, 467, 260, 75, 60,
            166, 238, 239, 79, 162, 127, 139, 72, 11, 37, 121, 232, 120, 73, 72, 39,
            114, 128, 47, 233, 232, 128, 103, 104, 67, 152, 175, 148, 173, 157, 155,
            119, 118, 101, 74, 73, 40, 107, 9, 108, 49, 48, 131, 32, 194, 211, 184, 74,
            185, 191, 80, 183, 185, 40, 186, 119, 230, 118, 210, 202, 214, 84, 83, 17,
            77, 76, 146, 161, 160, 30, 190, 56, 173, 182, 106, 194, 138, 135, 192, 129,
            203, 98, 54, 21, 68, 5, 51, 4, 145, 144, 23, 90, 77, 91, 207, 205, 187, 83,
            201, 18, 181, 91, 182, 180, 90, 181, 16, 85, 17, 205, 206, 36, 176, 148,
            140, 165, 92, 39, 245, 193, 244, 27, 159, 28, 30, 247, 161, 174, 236, 196,
            103, 54, 104, 55, 193, 8, 111, 117, 31, 221, 189, 55, 240, 98, 99, 142, 126,
            100, 219, 166, 218, 112, 155, 26, 198, 209, 131, 169, 135, 150, 114, 47,
            217, 224, 223, 53, 220, 45, 134, 32, 211, 140, 109, 67, 108, 146, 43, 91,
            231, 230, 120, 113, 226, 247, 105, 63, 52, 241, 238, 242, 124, 46, 156, 95,
            78, 96, 70, 46, 63, 116, 143, 227, 116, 123, 111, 1, 44, 19, 3, 236, 51,
            207, 216, 205, 26, 154, 22, 165, 39, 167, 199, 200, 208, 101, 36, 100, 43,
            57, 202, 242, 20, 99, 56, 28, 157, 124, 35, 113, 29, 160, 27, 211, 204, 210,
            124, 113, 46, 106, 43, 204, 96, 62, 77, 227, 137, 116, 73, 41, 72, 36, 203,
            142, 235, 64, 240, 48, 49, 64, 42, 41, 74, 214, 212, 207, 183, 42, 184, 210,
            169, 211, 140, 170, 176, 104, 105, 69, 193, 122, 168, 50, 123, 187, 89, 96,
            90, 66, 65, 107, 179, 89, 180, 119, 101, 120, 68, 63, 104, 234, 93, 227, 16,
            15, 85, 209, 129, 49, 15, 14, 86, 107, 55, 9, 120, 100, 121, 153, 145, 22,
            178, 88, 179, 197, 6, 196, 89, 88, 96, 135, 138, 136, 138, 215, 172, 218,
            115, 219, 41, 42, 81, 5, 195, 51, 57, 43, 61, 208, 171, 199, 41, 81, 38,
            224, 53, 225, 24, 144, 110, 105, 52, 66, 118, 229, 117, 227, 34, 234, 66,
            107, 69, 10, 109, 151, 219, 48, 235, 183, 62, 191, 142, 129, 126, 116, 111,
            143, 7, 163, 246, 118, 117, 50, 223, 222, 52, 94, 19, 141, 222, 221, 65,
            196, 3, 197, 45, 220, 44, 156, 70, 139, 188, 122, 245, 139, 71, 162, 145,
            153, 159, 149, 170, 150, 122, 188, 196, 206, 216, 92, 163, 144, 161, 164, 2,
            167, 242, 141, 241, 0, 164, 37, 11, 72, 12, 144, 145, 160, 12, 38, 13, 70,
            63, 71, 31, 226, 111, 157, 158, 154, 36, 101, 205, 203, 206, 165, 126, 209,
            217, 98, 165, 97, 237, 220, 218, 237, 239, 241, 210, 214, 169, 140, 171, 32,
            241, 125, 237, 179, 86, 178, 180, 85, 179, 181, 84, 180, 182, 83, 181, 194,
            201, 182, 177, 137, 132, 184, 76, 183, 185, 61, 184, 186, 57, 185, 216, 212,
            186, 192, 214, 187, 139, 34, 156, 218, 79, 237, 147, 123, 177, 45, 44, 4,
            208, 201, 32, 98, 64, 129, 192, 213, 138, 235, 59, 219, 141, 242, 97, 97, 2,
            141, 240, 75, 235, 229, 24, 228, 31, 25, 226, 230, 23, 229, 231, 22, 230,
            232, 26, 231, 233, 112, 232, 244, 189, 243, 189, 221, 190, 222, 28, 221,
            223, 27, 222, 224, 29, 223, 225, 30, 224, 113, 247, 225, 99, 60, 240, 213,
            147, 215, 60, 20, 166, 192, 187, 213, 243, 112, 244, 244, 233, 245, 245,
            128, 188, 188, 114, 174, 134, 131, 220, 174, 217, 236, 236, 198, 134, 215,
            177, 58, 156, 143, 124, 25, 110, 7, 31, 228, 25, 264, 356, 368, 0, 11, 267,
            451, 452, 349, 267, 302, 269, 350, 357, 277, 350, 452, 357, 299, 333, 297,
            396, 175, 377, 381, 384, 382, 280, 347, 330, 269, 303, 270, 151, 9, 337,
            344, 278, 360, 424, 418, 431, 270, 304, 409, 272, 310, 407, 322, 270, 410,
            449, 450, 347, 432, 422, 434, 18, 313, 17, 291, 306, 375, 259, 387, 260,
            424, 335, 418, 434, 364, 416, 391, 423, 327, 301, 251, 298, 275, 281, 4,
            254, 373, 253, 375, 307, 321, 280, 425, 411, 200, 421, 18, 335, 321, 406,
            321, 320, 405, 314, 315, 17, 423, 426, 266, 396, 377, 369, 270, 322, 269,
            413, 417, 464, 385, 386, 258, 248, 456, 419, 298, 284, 333, 168, 417, 8,
            448, 346, 261, 417, 413, 285, 326, 327, 328, 277, 355, 329, 309, 392, 438,
            381, 382, 256, 279, 429, 360, 365, 364, 379, 355, 277, 437, 282, 443, 283,
            281, 275, 363, 395, 431, 369, 299, 297, 337, 335, 273, 321, 348, 450, 349,
            359, 446, 467, 283, 293, 282, 250, 458, 462, 300, 276, 383, 292, 308, 325,
            283, 276, 293, 264, 372, 447, 346, 352, 340, 354, 274, 19, 363, 456, 281,
            426, 436, 425, 380, 381, 252, 267, 269, 393, 421, 200, 428, 371, 266, 329,
            432, 287, 422, 290, 250, 328, 385, 258, 384, 446, 265, 342, 386, 387, 257,
            422, 424, 430, 445, 342, 276, 422, 273, 424, 306, 292, 307, 352, 366, 345,
            268, 271, 302, 358, 423, 371, 327, 294, 460, 331, 279, 294, 303, 271, 304,
            436, 432, 427, 304, 272, 408, 395, 394, 431, 378, 395, 400, 296, 334, 299,
            6, 351, 168, 376, 352, 411, 307, 325, 320, 285, 295, 336, 320, 319, 404,
            329, 330, 349, 334, 293, 333, 366, 323, 447, 316, 15, 315, 331, 358, 279,
            317, 14, 316, 8, 285, 9, 277, 329, 350, 253, 374, 252, 319, 318, 403, 351,
            6, 419, 324, 318, 325, 397, 367, 365, 288, 435, 397, 278, 344, 439, 310,
            272, 311, 248, 195, 281, 375, 273, 291, 175, 396, 199, 312, 311, 268, 276,
            283, 445, 390, 373, 339, 295, 282, 296, 448, 449, 346, 356, 264, 454, 337,
            336, 299, 337, 338, 151, 294, 278, 455, 308, 292, 415, 429, 358, 355, 265,
            340, 372, 388, 390, 466, 352, 346, 280, 295, 442, 282, 354, 19, 370, 285,
            441, 295, 195, 248, 197, 457, 440, 274, 301, 300, 368, 417, 351, 465, 251,
            301, 389, 385, 380, 386, 394, 395, 379, 399, 412, 419, 410, 436, 322, 387,
            373, 388, 326, 2, 393, 354, 370, 461, 393, 164, 267, 268, 302, 12, 386, 374,
            387, 312, 268, 13, 298, 293, 301, 265, 446, 340, 380, 385, 381, 280, 330,
            425, 322, 426, 391, 420, 429, 437, 393, 391, 326, 344, 440, 438, 458, 459,
            461, 364, 434, 394, 428, 396, 262, 274, 354, 457, 317, 316, 402, 316, 315,
            403, 315, 314, 404, 314, 313, 405, 313, 421, 406, 323, 366, 361, 292, 306,
            407, 306, 291, 408, 291, 287, 409, 287, 432, 410, 427, 434, 411, 372, 264,
            383, 459, 309, 457, 366, 352, 401, 1, 274, 4, 418, 421, 262, 331, 294, 358,
            435, 433, 367, 392, 289, 439, 328, 462, 326, 94, 2, 370, 289, 305, 455, 339,
            254, 448, 359, 255, 446, 254, 253, 449, 253, 252, 450, 252, 256, 451, 256,
            341, 452, 414, 413, 463, 286, 441, 414, 286, 258, 441, 258, 257, 442, 257,
            259, 443, 259, 260, 444, 260, 467, 445, 309, 459, 250, 305, 289, 290, 305,
            290, 460, 401, 376, 435, 309, 250, 392, 376, 411, 433, 453, 341, 464, 357,
            453, 465, 343, 357, 412, 437, 343, 399, 344, 360, 440, 420, 437, 456, 360,
            420, 363, 361, 401, 288, 265, 372, 353, 390, 339, 249, 339, 448, 255
        };

        private static readonly Vector2[] UV = new Vector2[]
        {
            new (0.499976992607117f, 0.652534008026123f),
            new (0.500025987625122f, 0.547487020492554f),
            new (0.499974012374878f, 0.602371990680695f),
            new (0.482113003730774f, 0.471979022026062f),
            new (0.500150978565216f, 0.527155995368958f),
            new (0.499909996986389f, 0.498252987861633f),
            new (0.499523013830185f, 0.40106201171875f),
            new (0.289712011814117f, 0.380764007568359f),
            new (0.499954998493195f, 0.312398016452789f),
            new (0.499987006187439f, 0.269918978214264f),
            new (0.500023007392883f, 0.107050001621246f),
            new (0.500023007392883f, 0.666234016418457f),
            new (0.5000159740448f, 0.679224014282227f),
            new (0.500023007392883f, 0.692348003387451f),
            new (0.499976992607117f, 0.695277988910675f),
            new (0.499976992607117f, 0.70593398809433f),
            new (0.499976992607117f, 0.719385027885437f),
            new (0.499976992607117f, 0.737019002437592f),
            new (0.499967992305756f, 0.781370997428894f),
            new (0.499816000461578f, 0.562981009483337f),
            new (0.473773002624512f, 0.573909997940063f),
            new (0.104906998574734f, 0.254140973091125f),
            new (0.365929991006851f, 0.409575998783112f),
            new (0.338757991790771f, 0.41302502155304f),
            new (0.311120003461838f, 0.409460008144379f),
            new (0.274657994508743f, 0.389131009578705f),
            new (0.393361985683441f, 0.403706014156342f),
            new (0.345234006643295f, 0.344011008739471f),
            new (0.370094001293182f, 0.346076011657715f),
            new (0.319321990013123f, 0.347265005111694f),
            new (0.297903001308441f, 0.353591024875641f),
            new (0.24779200553894f, 0.410809993743896f),
            new (0.396889001131058f, 0.842755019664764f),
            new (0.280097991228104f, 0.375599980354309f),
            new (0.106310002505779f, 0.399955987930298f),
            new (0.2099249958992f, 0.391353011131287f),
            new (0.355807989835739f, 0.534406006336212f),
            new (0.471751004457474f, 0.65040397644043f),
            new (0.474155008792877f, 0.680191993713379f),
            new (0.439785003662109f, 0.657229006290436f),
            new (0.414617002010345f, 0.66654098033905f),
            new (0.450374007225037f, 0.680860996246338f),
            new (0.428770989179611f, 0.682690978050232f),
            new (0.374971002340317f, 0.727805018424988f),
            new (0.486716985702515f, 0.547628998756409f),
            new (0.485300987958908f, 0.527395009994507f),
            new (0.257764995098114f, 0.314490020275116f),
            new (0.401223003864288f, 0.455172002315521f),
            new (0.429818987846375f, 0.548614978790283f),
            new (0.421351999044418f, 0.533740997314453f),
            new (0.276895999908447f, 0.532056987285614f),
            new (0.483370006084442f, 0.499586999416351f),
            new (0.33721199631691f, 0.282882988452911f),
            new (0.296391993761063f, 0.293242990970612f),
            new (0.169294998049736f, 0.193813979625702f),
            new (0.447580009698868f, 0.302609980106354f),
            new (0.392390012741089f, 0.353887975215912f),
            new (0.354490011930466f, 0.696784019470215f),
            new (0.067304998636246f, 0.730105042457581f),
            new (0.442739009857178f, 0.572826027870178f),
            new (0.457098007202148f, 0.584792017936707f),
            new (0.381974011659622f, 0.694710969924927f),
            new (0.392388999462128f, 0.694203019142151f),
            new (0.277076005935669f, 0.271932005882263f),
            new (0.422551989555359f, 0.563233017921448f),
            new (0.385919004678726f, 0.281364023685455f),
            new (0.383103013038635f, 0.255840003490448f),
            new (0.331431001424789f, 0.119714021682739f),
            new (0.229923993349075f, 0.232002973556519f),
            new (0.364500999450684f, 0.189113974571228f),
            new (0.229622006416321f, 0.299540996551514f),
            new (0.173287004232407f, 0.278747975826263f),
            new (0.472878992557526f, 0.666198015213013f),
            new (0.446828007698059f, 0.668527007102966f),
            new (0.422762006521225f, 0.673889994621277f),
            new (0.445307999849319f, 0.580065965652466f),
            new (0.388103008270264f, 0.693961024284363f),
            new (0.403039008378983f, 0.706539988517761f),
            new (0.403629004955292f, 0.693953037261963f),
            new (0.460041999816895f, 0.557139039039612f),
            new (0.431158006191254f, 0.692366003990173f),
            new (0.452181994915009f, 0.692366003990173f),
            new (0.475387006998062f, 0.692366003990173f),
            new (0.465828001499176f, 0.779190003871918f),
            new (0.472328990697861f, 0.736225962638855f),
            new (0.473087012767792f, 0.717857003211975f),
            new (0.473122000694275f, 0.704625964164734f),
            new (0.473033010959625f, 0.695277988910675f),
            new (0.427942007780075f, 0.695277988910675f),
            new (0.426479011774063f, 0.703539967536926f),
            new (0.423162013292313f, 0.711845993995667f),
            new (0.4183090031147f, 0.720062971115112f),
            new (0.390094995498657f, 0.639572978019714f),
            new (0.013953999616206f, 0.560034036636353f),
            new (0.499913990497589f, 0.58014702796936f),
            new (0.413199990987778f, 0.69539999961853f),
            new (0.409626007080078f, 0.701822996139526f),
            new (0.468080013990402f, 0.601534962654114f),
            new (0.422728985548019f, 0.585985004901886f),
            new (0.463079988956451f, 0.593783974647522f),
            new (0.37211999297142f, 0.47341400384903f),
            new (0.334562003612518f, 0.496073007583618f),
            new (0.411671012639999f, 0.546965003013611f),
            new (0.242175996303558f, 0.14767599105835f),
            new (0.290776997804642f, 0.201445996761322f),
            new (0.327338010072708f, 0.256527006626129f),
            new (0.399509996175766f, 0.748921036720276f),
            new (0.441727995872498f, 0.261676013469696f),
            new (0.429764986038208f, 0.187834024429321f),
            new (0.412198007106781f, 0.108901023864746f),
            new (0.288955003023148f, 0.398952007293701f),
            new (0.218936994671822f, 0.435410976409912f),
            new (0.41278201341629f, 0.398970007896423f),
            new (0.257135003805161f, 0.355440020561218f),
            new (0.427684992551804f, 0.437960982322693f),
            new (0.448339998722076f, 0.536936044692993f),
            new (0.178560003638268f, 0.45755398273468f),
            new (0.247308000922203f, 0.457193970680237f),
            new (0.286267012357712f, 0.467674970626831f),
            new (0.332827985286713f, 0.460712015628815f),
            new (0.368755996227264f, 0.447206974029541f),
            new (0.398963987827301f, 0.432654976844788f),
            new (0.476410001516342f, 0.405806005001068f),
            new (0.189241006970406f, 0.523923993110657f),
            new (0.228962004184723f, 0.348950982093811f),
            new (0.490725994110107f, 0.562400996685028f),
            new (0.404670000076294f, 0.485132992267609f),
            new (0.019469000399113f, 0.401564002037048f),
            new (0.426243007183075f, 0.420431017875671f),
            new (0.396993011236191f, 0.548797011375427f),
            new (0.266469985246658f, 0.376977026462555f),
            new (0.439121007919312f, 0.51895797252655f),
            new (0.032313998788595f, 0.644356966018677f),
            new (0.419054001569748f, 0.387154996395111f),
            new (0.462783008813858f, 0.505746960639954f),
            new (0.238978996872902f, 0.779744982719421f),
            new (0.198220998048782f, 0.831938028335571f),
            new (0.107550002634525f, 0.540755033493042f),
            new (0.183610007166862f, 0.740257024765015f),
            new (0.134409993886948f, 0.333683013916016f),
            new (0.385764002799988f, 0.883153975009918f),
            new (0.490967005491257f, 0.579378008842468f),
            new (0.382384985685349f, 0.508572995662689f),
            new (0.174399003386497f, 0.397670984268188f),
            new (0.318785011768341f, 0.39623498916626f),
            new (0.343364000320435f, 0.400596976280212f),
            new (0.396100014448166f, 0.710216999053955f),
            new (0.187885001301765f, 0.588537991046906f),
            new (0.430987000465393f, 0.944064974784851f),
            new (0.318993002176285f, 0.898285031318665f),
            new (0.266247987747192f, 0.869701027870178f),
            new (0.500023007392883f, 0.190576016902924f),
            new (0.499976992607117f, 0.954452991485596f),
            new (0.366169989109039f, 0.398822009563446f),
            new (0.393207013607025f, 0.39553701877594f),
            new (0.410373002290726f, 0.391080021858215f),
            new (0.194993004202843f, 0.342101991176605f),
            new (0.388664990663528f, 0.362284004688263f),
            new (0.365961998701096f, 0.355970978736877f),
            new (0.343364000320435f, 0.355356991291046f),
            new (0.318785011768341f, 0.35834002494812f),
            new (0.301414996385574f, 0.363156020641327f),
            new (0.058132998645306f, 0.319076001644135f),
            new (0.301414996385574f, 0.387449026107788f),
            new (0.499987989664078f, 0.618434011936188f),
            new (0.415838003158569f, 0.624195992946625f),
            new (0.445681989192963f, 0.566076993942261f),
            new (0.465844005346298f, 0.620640993118286f),
            new (0.49992299079895f, 0.351523995399475f),
            new (0.288718998432159f, 0.819945991039276f),
            new (0.335278987884521f, 0.852819979190826f),
            new (0.440512001514435f, 0.902418971061707f),
            new (0.128294005990028f, 0.791940987110138f),
            new (0.408771991729736f, 0.373893976211548f),
            new (0.455606997013092f, 0.451801002025604f),
            new (0.499877005815506f, 0.908990025520325f),
            new (0.375436991453171f, 0.924192011356354f),
            new (0.11421000212431f, 0.615022003650665f),
            new (0.448662012815475f, 0.695277988910675f),
            new (0.4480200111866f, 0.704632043838501f),
            new (0.447111994028091f, 0.715808033943176f),
            new (0.444831997156143f, 0.730794012546539f),
            new (0.430011987686157f, 0.766808986663818f),
            new (0.406787008047104f, 0.685672998428345f),
            new (0.400738000869751f, 0.681069016456604f),
            new (0.392399996519089f, 0.677703022956848f),
            new (0.367855995893478f, 0.663918972015381f),
            new (0.247923001646996f, 0.601333022117615f),
            new (0.452769994735718f, 0.420849978923798f),
            new (0.43639200925827f, 0.359887003898621f),
            new (0.416164010763168f, 0.368713974952698f),
            new (0.413385987281799f, 0.692366003990173f),
            new (0.228018000721931f, 0.683571994304657f),
            new (0.468268007040024f, 0.352671027183533f),
            new (0.411361992359161f, 0.804327011108398f),
            new (0.499989002943039f, 0.469825029373169f),
            new (0.479153990745544f, 0.442654013633728f),
            new (0.499974012374878f, 0.439637005329132f),
            new (0.432112008333206f, 0.493588984012604f),
            new (0.499886006116867f, 0.866917014122009f),
            new (0.49991300702095f, 0.821729004383087f),
            new (0.456548988819122f, 0.819200992584229f),
            new (0.344549000263214f, 0.745438992977142f),
            new (0.37890899181366f, 0.574010014533997f),
            new (0.374292999505997f, 0.780184984207153f),
            new (0.319687992334366f, 0.570737957954407f),
            new (0.357154995203018f, 0.604269981384277f),
            new (0.295284003019333f, 0.621580958366394f),
            new (0.447750002145767f, 0.862477004528046f),
            new (0.410986006259918f, 0.508723020553589f),
            new (0.31395098567009f, 0.775308012962341f),
            new (0.354128003120422f, 0.812552988529205f),
            new (0.324548006057739f, 0.703992962837219f),
            new (0.189096003770828f, 0.646299958229065f),
            new (0.279776990413666f, 0.71465802192688f),
            new (0.1338230073452f, 0.682700991630554f),
            new (0.336768001317978f, 0.644733011722565f),
            new (0.429883986711502f, 0.466521978378296f),
            new (0.455527991056442f, 0.548622965812683f),
            new (0.437114000320435f, 0.558896005153656f),
            new (0.467287987470627f, 0.529924988746643f),
            new (0.414712011814117f, 0.335219979286194f),
            new (0.37704598903656f, 0.322777986526489f),
            new (0.344107985496521f, 0.320150971412659f),
            new (0.312875986099243f, 0.32233202457428f),
            new (0.283526003360748f, 0.333190023899078f),
            new (0.241245999932289f, 0.382785975933075f),
            new (0.102986000478268f, 0.468762993812561f),
            new (0.267612010240555f, 0.424560010433197f),
            new (0.297879010438919f, 0.433175981044769f),
            new (0.333433985710144f, 0.433878004550934f),
            new (0.366427004337311f, 0.426115989685059f),
            new (0.396012008190155f, 0.416696012020111f),
            new (0.420121014118195f, 0.41022801399231f),
            new (0.007561000064015f, 0.480777025222778f),
            new (0.432949006557465f, 0.569517970085144f),
            new (0.458638995885849f, 0.479089021682739f),
            new (0.473466008901596f, 0.545744001865387f),
            new (0.476087987422943f, 0.563830018043518f),
            new (0.468472003936768f, 0.555056989192963f),
            new (0.433990985155106f, 0.582361996173859f),
            new (0.483518004417419f, 0.562983989715576f),
            new (0.482482999563217f, 0.57784903049469f),
            new (0.42645001411438f, 0.389798998832703f),
            new (0.438998997211456f, 0.39649498462677f),
            new (0.450067013502121f, 0.400434017181396f),
            new (0.289712011814117f, 0.368252992630005f),
            new (0.276670008897781f, 0.363372981548309f),
            new (0.517862021923065f, 0.471948027610779f),
            new (0.710287988185883f, 0.380764007568359f),
            new (0.526226997375488f, 0.573909997940063f),
            new (0.895093023777008f, 0.254140973091125f),
            new (0.634069979190826f, 0.409575998783112f),
            new (0.661242008209229f, 0.41302502155304f),
            new (0.688880026340485f, 0.409460008144379f),
            new (0.725341975688934f, 0.389131009578705f),
            new (0.606630027294159f, 0.40370500087738f),
            new (0.654766023159027f, 0.344011008739471f),
            new (0.629905998706818f, 0.346076011657715f),
            new (0.680678009986877f, 0.347265005111694f),
            new (0.702096998691559f, 0.353591024875641f),
            new (0.75221198797226f, 0.410804986953735f),
            new (0.602918028831482f, 0.842862963676453f),
            new (0.719901978969574f, 0.375599980354309f),
            new (0.893692970275879f, 0.399959981441498f),
            new (0.790081977844238f, 0.391354024410248f),
            new (0.643998026847839f, 0.534487962722778f),
            new (0.528249025344849f, 0.65040397644043f),
            new (0.525849997997284f, 0.680191040039062f),
            new (0.560214996337891f, 0.657229006290436f),
            new (0.585384011268616f, 0.66654098033905f),
            new (0.549625992774963f, 0.680860996246338f),
            new (0.57122802734375f, 0.682691991329193f),
            new (0.624852001667023f, 0.72809898853302f),
            new (0.513050019741058f, 0.547281980514526f),
            new (0.51509702205658f, 0.527251958847046f),
            new (0.742246985435486f, 0.314507007598877f),
            new (0.598631024360657f, 0.454979002475739f),
            new (0.570338010787964f, 0.548575043678284f),
            new (0.578631997108459f, 0.533622980117798f),
            new (0.723087012767792f, 0.532054007053375f),
            new (0.516445994377136f, 0.499638974666595f),
            new (0.662801027297974f, 0.282917976379395f),
            new (0.70362401008606f, 0.293271005153656f),
            new (0.830704987049103f, 0.193813979625702f),
            new (0.552385985851288f, 0.302568018436432f),
            new (0.607609987258911f, 0.353887975215912f),
            new (0.645429015159607f, 0.696707010269165f),
            new (0.932694971561432f, 0.730105042457581f),
            new (0.557260990142822f, 0.572826027870178f),
            new (0.542901992797852f, 0.584792017936707f),
            new (0.6180260181427f, 0.694710969924927f),
            new (0.607590973377228f, 0.694203019142151f),
            new (0.722943007946014f, 0.271963000297546f),
            new (0.577413976192474f, 0.563166975975037f),
            new (0.614082992076874f, 0.281386971473694f),
            new (0.616907000541687f, 0.255886018276215f),
            new (0.668509006500244f, 0.119913995265961f),
            new (0.770092010498047f, 0.232020974159241f),
            new (0.635536015033722f, 0.189248979091644f),
            new (0.77039098739624f, 0.299556016921997f),
            new (0.826722025871277f, 0.278755009174347f),
            new (0.527121007442474f, 0.666198015213013f),
            new (0.553171992301941f, 0.668527007102966f),
            new (0.577238023281097f, 0.673889994621277f),
            new (0.554691970348358f, 0.580065965652466f),
            new (0.611896991729736f, 0.693961024284363f),
            new (0.59696102142334f, 0.706539988517761f),
            new (0.596370995044708f, 0.693953037261963f),
            new (0.539958000183105f, 0.557139039039612f),
            new (0.568841993808746f, 0.692366003990173f),
            new (0.547818005084991f, 0.692366003990173f),
            new (0.52461302280426f, 0.692366003990173f),
            new (0.534089982509613f, 0.779141008853912f),
            new (0.527670979499817f, 0.736225962638855f),
            new (0.526912987232208f, 0.717857003211975f),
            new (0.526877999305725f, 0.704625964164734f),
            new (0.526966989040375f, 0.695277988910675f),
            new (0.572058022022247f, 0.695277988910675f),
            new (0.573521018028259f, 0.703539967536926f),
            new (0.57683801651001f, 0.711845993995667f),
            new (0.581691026687622f, 0.720062971115112f),
            new (0.609944999217987f, 0.639909982681274f),
            new (0.986046016216278f, 0.560034036636353f),
            new (0.5867999792099f, 0.69539999961853f),
            new (0.590372025966644f, 0.701822996139526f),
            new (0.531915009021759f, 0.601536989212036f),
            new (0.577268004417419f, 0.585934996604919f),
            new (0.536915004253387f, 0.593786001205444f),
            new (0.627542972564697f, 0.473352015018463f),
            new (0.665585994720459f, 0.495950996875763f),
            new (0.588353991508484f, 0.546862006187439f),
            new (0.757824003696442f, 0.14767599105835f),
            new (0.709249973297119f, 0.201507985591888f),
            new (0.672684013843536f, 0.256581008434296f),
            new (0.600408971309662f, 0.74900496006012f),
            new (0.55826598405838f, 0.261672019958496f),
            new (0.570303976535797f, 0.187870979309082f),
            new (0.588165998458862f, 0.109044015407562f),
            new (0.711045026779175f, 0.398952007293701f),
            new (0.781069993972778f, 0.435405015945435f),
            new (0.587247014045715f, 0.398931980133057f),
            new (0.742869973182678f, 0.355445981025696f),
            new (0.572156012058258f, 0.437651991844177f),
            new (0.55186802148819f, 0.536570012569427f),
            new (0.821442008018494f, 0.457556009292603f),
            new (0.752701997756958f, 0.457181990146637f),
            new (0.71375697851181f, 0.467626988887787f),
            new (0.66711300611496f, 0.460672974586487f),
            new (0.631101012229919f, 0.447153985500336f),
            new (0.6008620262146f, 0.432473003864288f),
            new (0.523481011390686f, 0.405627012252808f),
            new (0.810747981071472f, 0.523926019668579f),
            new (0.771045982837677f, 0.348959028720856f),
            new (0.509127020835876f, 0.562718033790588f),
            new (0.595292985439301f, 0.485023975372314f),
            new (0.980530977249146f, 0.401564002037048f),
            new (0.573499977588654f, 0.420000016689301f),
            new (0.602994978427887f, 0.548687994480133f),
            new (0.733529984951019f, 0.376977026462555f),
            new (0.560611009597778f, 0.519016981124878f),
            new (0.967685997486115f, 0.644356966018677f),
            new (0.580985009670258f, 0.387160003185272f),
            new (0.537728011608124f, 0.505385041236877f),
            new (0.760966002941132f, 0.779752969741821f),
            new (0.801778972148895f, 0.831938028335571f),
            new (0.892440974712372f, 0.54076099395752f),
            new (0.816350996494293f, 0.740260004997253f),
            new (0.865594983100891f, 0.333687007427216f),
            new (0.614073991775513f, 0.883246004581451f),
            new (0.508952975273132f, 0.579437971115112f),
            new (0.617941975593567f, 0.508316040039062f),
            new (0.825608015060425f, 0.397674977779388f),
            new (0.681214988231659f, 0.39623498916626f),
            new (0.656635999679565f, 0.400596976280212f),
            new (0.603900015354156f, 0.710216999053955f),
            new (0.81208598613739f, 0.588539004325867f),
            new (0.56801301240921f, 0.944564998149872f),
            new (0.681007981300354f, 0.898285031318665f),
            new (0.733752012252808f, 0.869701027870178f),
            new (0.633830010890961f, 0.398822009563446f),
            new (0.606792986392975f, 0.39553701877594f),
            new (0.589659988880157f, 0.391062021255493f),
            new (0.805015981197357f, 0.342108011245728f),
            new (0.611334979534149f, 0.362284004688263f),
            new (0.634037971496582f, 0.355970978736877f),
            new (0.656635999679565f, 0.355356991291046f),
            new (0.681214988231659f, 0.35834002494812f),
            new (0.698584973812103f, 0.363156020641327f),
            new (0.941866993904114f, 0.319076001644135f),
            new (0.698584973812103f, 0.387449026107788f),
            new (0.584177017211914f, 0.624107003211975f),
            new (0.554318010807037f, 0.566076993942261f),
            new (0.534153997898102f, 0.62064003944397f),
            new (0.711217999458313f, 0.819975018501282f),
            new (0.664629995822906f, 0.852871000766754f),
            new (0.559099972248077f, 0.902631998062134f),
            new (0.871706008911133f, 0.791940987110138f),
            new (0.591234028339386f, 0.373893976211548f),
            new (0.544341027736664f, 0.451583981513977f),
            new (0.624562978744507f, 0.924192011356354f),
            new (0.88577002286911f, 0.615028977394104f),
            new (0.551338016986847f, 0.695277988910675f),
            new (0.551980018615723f, 0.704632043838501f),
            new (0.552887976169586f, 0.715808033943176f),
            new (0.555167973041534f, 0.730794012546539f),
            new (0.569944024085999f, 0.767035007476807f),
            new (0.593203008174896f, 0.685675978660583f),
            new (0.599261999130249f, 0.681069016456604f),
            new (0.607599973678589f, 0.677703022956848f),
            new (0.631937980651855f, 0.663500010967255f),
            new (0.752032995223999f, 0.601315021514893f),
            new (0.547226011753082f, 0.420395016670227f),
            new (0.563543975353241f, 0.359827995300293f),
            new (0.583841025829315f, 0.368713974952698f),
            new (0.586614012718201f, 0.692366003990173f),
            new (0.771915018558502f, 0.683578014373779f),
            new (0.531597018241882f, 0.352482974529266f),
            new (0.588370978832245f, 0.804440975189209f),
            new (0.52079701423645f, 0.442565023899078f),
            new (0.567984998226166f, 0.493479013442993f),
            new (0.543282985687256f, 0.819254994392395f),
            new (0.655317008495331f, 0.745514988899231f),
            new (0.621008992195129f, 0.574018001556396f),
            new (0.625559985637665f, 0.78031200170517f),
            new (0.680198013782501f, 0.570719003677368f),
            new (0.64276397228241f, 0.604337990283966f),
            new (0.704662978649139f, 0.621529996395111f),
            new (0.552012026309967f, 0.862591981887817f),
            new (0.589071989059448f, 0.508637011051178f),
            new (0.685944974422455f, 0.775357007980347f),
            new (0.645735025405884f, 0.812640011310577f),
            new (0.675342977046967f, 0.703978002071381f),
            new (0.810858011245728f, 0.646304965019226f),
            new (0.72012197971344f, 0.714666962623596f),
            new (0.866151988506317f, 0.682704985141754f),
            new (0.663187026977539f, 0.644596993923187f),
            new (0.570082008838654f, 0.466325998306274f),
            new (0.544561982154846f, 0.548375964164734f),
            new (0.562758982181549f, 0.558784961700439f),
            new (0.531987011432648f, 0.530140042304993f),
            new (0.585271000862122f, 0.335177004337311f),
            new (0.622952997684479f, 0.32277899980545f),
            new (0.655896008014679f, 0.320163011550903f),
            new (0.687132000923157f, 0.322345972061157f),
            new (0.716481983661652f, 0.333200991153717f),
            new (0.758756995201111f, 0.382786989212036f),
            new (0.897013008594513f, 0.468769013881683f),
            new (0.732392013072968f, 0.424547016620636f),
            new (0.70211398601532f, 0.433162987232208f),
            new (0.66652500629425f, 0.433866024017334f),
            new (0.633504986763f, 0.426087975502014f),
            new (0.603875994682312f, 0.416586995124817f),
            new (0.579657971858978f, 0.409945011138916f),
            new (0.992439985275269f, 0.480777025222778f),
            new (0.567192018032074f, 0.569419980049133f),
            new (0.54136598110199f, 0.478899002075195f),
            new (0.526564002037048f, 0.546118021011353f),
            new (0.523913025856018f, 0.563830018043518f),
            new (0.531529009342194f, 0.555056989192963f),
            new (0.566035985946655f, 0.582329034805298f),
            new (0.51631098985672f, 0.563053965568542f),
            new (0.5174720287323f, 0.577877044677734f),
            new (0.573594987392426f, 0.389806985855103f),
            new (0.560697972774506f, 0.395331978797913f),
            new (0.549755990505219f, 0.399751007556915f),
            new (0.710287988185883f, 0.368252992630005f),
            new (0.723330020904541f, 0.363372981548309f),
        };

        public static Mesh CreateMesh()
        {
            var mesh = new Mesh
            {
                vertices = new Vector3[UV.Length],
                triangles = TRIANGLES,
                uv = UV
            };
            mesh.MarkDynamic();
            return mesh;
        }

        public static void UpdateMesh(Mesh mesh, Vector3[] vertices)
        {
            mesh.vertices = vertices;
            mesh.RecalculateBounds();
            mesh.RecalculateNormals();
        }
    }
}
